package dao;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

public class DAOGeneral {
    private EntityManagerFactory emf = null;
    private EntityManager em = null;    
    
    public EntityManager getEntityManager() {        
        if (emf == null && em == null) {
            emf = Persistence.createEntityManagerFactory("ICEfacesProject");
            em = emf.createEntityManager();
        }
                
        return em;
    }
    
    public void setEntityManager(EntityManager em) {
        this.em = em;
    }
}
